package cn.cvs.service.Impl;

import cn.cvs.dao.SysUserMapper;
import cn.cvs.pojo.SysUser;
import cn.cvs.service.SysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
@Transactional
@Service("SysuserService")
public class SysUserServiceImpl implements SysUserService {
    @Autowired
    private SysUserMapper sysUserMapper;
    @Override
    public List<SysUser> getList(SysUser sysUser){

    }
    @Override
    public boolean add(SysUser sysUser){

    }
//    private SysUserMapper sysUserMapper;
//    @Override
//    public List<SysUser> getList (SysUser sysUser){
//        try {
//            return sysUserMapper.selectSysUserList(sysUser);
//        }catch (RuntimeException e){
//            e.printStackTrace();
//            throw e;
//        }
//    }
//    public SysUserMapper getSysUserMapper(){
//        return sysUserMapper;
//    }
//    public void setSysUserMapper(SysUserMapper sysUserMapper){
//        this.sysUserMapper=sysUserMapper;
//    }
@Autowired
private SysUserMapper sysUserMapper;
    @Override
    public List<SysUser> getList(SysUser sysUser) {
        try {
            return sysUserMapper.selectSysUserList(sysUser);
        }catch (RuntimeException e){
            e.printStackTrace();
            throw e;
        }
    }

    @Override
    public boolean add(SysUser sysUser) {
        boolean result = false;
        try {
            if (sysUserMapper.add(sysUser) == 1){
                result = true;
                //测试事务回滚,打开注释
            }
        }catch (RuntimeException e){
            e.printStackTrace();;
            throw e;
        }
        return result;
    }
//    @Transactional
//    @Service("SysUserService")
//    public
}
